﻿using System.ComponentModel.DataAnnotations;
using EPiServer.Core;
using EPiServer.DataAnnotations;

namespace StarterKit.Web.Models.Pages
{
    /* BEST PRACTICE TIP
     * Always use your own base class for page types in your projects,
     * instead of having your page types inherit PageData directly.
     * That way you can easily extend all page types by modifying your base class. */

    /// <summary>
    /// Base class for all page types
    /// </summary>
    public class BasePageData : EPiServer.Core.PageData
    {
        [Display(
            Name = "Meta Title",
            GroupName = "Metadata",
            Order = 100)]
        [CultureSpecific]
        public virtual string MetaTitle
        {
            get
            {
                var metaTitle = this.GetPropertyValue(p => p.MetaTitle);

                // Use explicitly set meta title, otherwise fall back to page name
                return !string.IsNullOrWhiteSpace(metaTitle)
                       ? metaTitle
                       : PageName;
            }
            set { this.SetPropertyValue(p => p.MetaTitle, value); }
        }

        //[Display(
        //    Name = "Meta Keywords",
        //    GroupName = "Metadata",
        //    Order = 200)]
        //[CultureSpecific]
        //public virtual string[] MetaKeywords { get; set; }

        [Display(
            Name = "Meta Description",
            GroupName = "Metadata",
            Order = 300)]
        [CultureSpecific]
        public virtual string MetaDescription { get; set; }

    }
}